//
//  FXCStatusCell.m
//  XinLangFeiBo
//
//  Created by dllo on 16/3/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "FXCStatusCell.h"

#import "FXCOriginalView.h"
#import "FXCRetweetedView.h"
#import "FXCToolBarView.h"

#import "FXCStatus.h"

@interface FXCStatusCell ()

@property (nonatomic, weak) FXCOriginalView *originalView;
@property (nonatomic, weak) FXCRetweetedView *retweetedView;
@property (nonatomic, weak) FXCToolBarView *toolBar;


@end

@implementation FXCStatusCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        // 添加所有子控件
        [self setUpAllSubviews];
        
        self.backgroundColor = [UIColor clearColor];
    }
    
    return self;
}

- (void)setUpAllSubviews
{
    // 添加原创微博
    FXCOriginalView *originalView = [[FXCOriginalView alloc] init];
    [self.contentView addSubview:originalView];
    _originalView = originalView;
    
    // 添加转发微博
    FXCRetweetedView *retweetedView = [[FXCRetweetedView alloc] init];
    [self.contentView addSubview:retweetedView];
    _retweetedView = retweetedView;
    
    // 添加工具条
    FXCToolBarView *toolBar = [[FXCToolBarView alloc] init];
    [self.contentView addSubview:toolBar];
    _toolBar = toolBar;
}




- (void)setStatusF:(FXCStatusFrame *)statusF
{
    _statusF = statusF;
    
    FXCStatus *status = statusF.status; 
    
    // 设置原创微博
    _originalView.statusF = statusF;
    
    if (status.retweeted_status) {
        
        // 设置转发微博
        _retweetedView.statusF = statusF;
        _retweetedView.hidden = NO;
    }else{
        _retweetedView.hidden = YES;
    }
    
    // 设置工具条的位置
    _toolBar.status = status;
    _toolBar.frame = statusF.toolBarViewF;
    
    
}

@end
